package Test02;

public class Test02 {
    public static void main(String[] args) {
        Solution solution=new Solution();
        int[] a={1,1,2};
        int i = solution.removeDuplicates(a);
        System.out.println(i);
    }
}

class Solution {
    public int removeDuplicates(int[] nums) {
        if(nums.length==0) return 0;
        int ans=0;
        for(int i=0;i<nums.length;i++){
            if(nums[i]!=nums[ans]){
                nums[ans++]=nums[i];
            }

        }
        return ans+1;
    }

}
